/**
 * 
 */
package org.seginfo.httpfuzzer;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;

import org.seginfo.httpfuzzer.connection.status.Status;
import org.seginfo.httpfuzzer.header.Connection;
import org.seginfo.httpfuzzer.header.UserAgent;

/**
 * @author mchiodi
 *
 */
public class SimpleFuzzCase implements FuzzCase, Serializable {
	
	private String id;
	private String httpVersion;
	private String method;
	private String path;
	private Collection requestProperties;
	private char[] content;
	private boolean useAlternativeContentLength;
	private String alternativeContentLength;
	
	private int result;
	private String host;
	private String server;
	private Status status;

	/**
	 * Default constructor.
	 */
	public SimpleFuzzCase() {
		this.id = new Long(new Date().getTime()).toString() + Math.random();
		this.httpVersion = "1.1";
		this.method = "GET";
		this.path = "/";
		this.requestProperties = new HashSet();
		this.useAlternativeContentLength = false;
		this.result = FuzzCase.NORMAL;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getId()
	 */
	public String getId() {
		return this.id;
	}

	public void setPath(String path) {
		this.path = path;
	}
	
	public void setAlternativeContentLength(String alternativeContentLength) {
		this.alternativeContentLength = alternativeContentLength;
	}

	public void setContent(char[] content) {
		this.content = content;
	}

	public void setHttpVersion(String httpVersion) {
		this.httpVersion = httpVersion;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public void setRequestProperties(Collection requestProperties) {
		this.requestProperties = requestProperties;
		
		/* Required fields */
		this.requestProperties.add(new UserAgent("IE8.0"));
		this.requestProperties.add(new Connection("close"));
	}

	public void useAlternativeContentLength(boolean use) {
		this.useAlternativeContentLength = use;
	}
	
	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getAlternativeContentLength()
	 */
	public String getAlternativeContentLength() {
		return this.alternativeContentLength;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getContent()
	 */
	public char[] getContent() {
		return this.content;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getHttpVersion()
	 */
	public String getHttpVersion() {
		return this.httpVersion;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getMethod()
	 */
	public String getMethod() {
		return this.method;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getRequestProperties()
	 */
	public Collection getRequestProperties() {
		return this.requestProperties;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#useAlternativeContentLength()
	 */
	public boolean useAlternativeContentLength() {
		return this.useAlternativeContentLength;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getPath()
	 */
	public String getPath() {
		return this.path;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getResult()
	 */
	public int getResult() {
		return this.result;
	}
	
	/**
	 * @param result
	 */
	public void setResult(int result) {
		this.result = result;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getHost()
	 */
	public String getHost() {
		return this.host;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#setHost(java.lang.String)
	 */
	public void setHost(String host) {
		this.host = host;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getServer()
	 */
	public String getServer() {
		return this.server;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#setServer(java.lang.String)
	 */
	public void setServer(String server) {
		this.server = server;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#getStatus()
	 */
	public Status getStatus() {
		return this.status;
	}

	/**
	 * @see org.seginfo.httpfuzzer.FuzzCase#setStatus(org.seginfo.httpfuzzer.connection.status.Status)
	 */
	public void setStatus(Status status) {
		this.status = status;
	}
}
